﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.ObjectFactory;
using YasharEl.Infrastructure.Caching.Orm;
using YasharEl.Infrastructure.Caching.Configuration;

namespace YasharEl.Infrastructure.Caching
{
    public class DisabledCacheManagerFactory : ICacheManagerFactory, IOrmCacheManagerFactory
    {
        public ICacheManager CreateCacheManager(CacheManagerConfig cacheManagerConfig, IDependencyRegistrar dependencyRegistrar)
        {
            DisabledCacheManager cacheManager = new DisabledCacheManager(cacheManagerConfig.Name);
            dependencyRegistrar.Register<ICacheManager>(cacheManager, cacheManagerConfig.Name, true);

            return cacheManager;
        }

        public IOrmCacheManager CreateAndRegisterCacheManager(OrmCacheManagerConfig ormCacheManagerConfig, IDependencyRegistrar dependencyRegistrar)
        {
            DisabledCacheManager cacheManager = new DisabledCacheManager(ormCacheManagerConfig.Name);
            dependencyRegistrar.Register<IOrmCacheManager>(cacheManager, ormCacheManagerConfig.Name, true);

            return cacheManager;
        }
    }
}
